package com.fs.service.impl;

import com.fs.mapper.RtaMapper;
import com.fs.pojo.Rta;
import com.fs.pojo.WhInvInventory;
import com.fs.service.RtaService;
import com.fs.vo.Condition;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author yyds
 * @fileName RtaServiceImpl
 * @date 2024/10/17 10:20
 * @description 采购退货服务方法
 **/
@Service
public class RtaServiceImpl implements RtaService {
    @Resource
    private RtaMapper rtaMapper;

    /**
     * 分页查询退货单
     * @param condition
     * @return
     */
    @Override
    public PageInfo<Rta> selectAll(Condition<Rta> condition) {
        PageHelper.startPage(condition.getPage(), condition.getCount());
        List<Rta> rta = rtaMapper.selectAll(condition.getSearch());
        return new PageInfo<>(rta);
    }
    /**
     * 新增退货单
     *
     * @param
     * @return yes/no
     */
    @Override
    public Integer addRta(Rta rta) {
        return rtaMapper.insert(rta);
    }
    /**
     * 根据编号删除退货单
     * @param id
     * @return yes/no
     */
    @Override
    public Boolean deleteRta(Integer id) {
        return rtaMapper.deleteById(id)>0;
    }
    /**
     * 根据编号修改退货单
     * @param condition
     * @return
     */
    @Override
    public Boolean updateRta(Condition<Rta> condition) {
        return rtaMapper.updateById(condition.getSearch())>0;
    }
    /**
     * 根据ID获取对象
     * @param id
     * @return
     */
    @Override
    public Rta selectById(Integer id) {
        return rtaMapper.selectById(id);
    }


}
